<template>
  <view>
    <view class="tabs">
      <view
        class="tab"
        v-for="(tab, index) in tabItem"
        :key="index"
        @click="selectTab(index)"
        :class="{ active: currentIndex === index }"
      >
        {{ tab }}
        <view class="underline" v-if="currentIndex === index"></view>
      </view>
    </view>

    <view class="tab-content">
      <view v-if="currentIndex === 0">
        <findItem></findItem>
        <findItem></findItem>
        <findItem></findItem>
        <findItem></findItem>
      </view>
      <view v-if="currentIndex === 1">这是选项卡 2 的内容</view>
      <view v-if="currentIndex === 2">这是选项卡 3 的内容</view>
    </view>
	
	<u-button text="月落"></u-button>
	
	<u-cell-group>
		<u-cell icon="setting-fill" title="个人设置"></u-cell>
		<u-cell icon="integral-fill" title="会员等级" value="新版本"></u-cell>
	</u-cell-group>
	
  </view>
</template>

<script>
export default {
  data() {
    return {
      currentIndex: 0,
      tabItem: ['公告', '求助', '活动']
    };
  },
  methods: {
    selectTab(index) {
      this.currentIndex = index;
    }
  }
};
</script>

<style lang="scss">
.tabs {
  display: flex;
  justify-content: space-around;
  background-color: #e0e0e0;
  border-radius: 16rpx;
  margin-bottom: 20rpx;
  padding: 10rpx 0;
}

.tab {
  flex: 1;
  padding: 20rpx 0;
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: 0.3s;
}

.tab.active {
  color: #c3ad40;
}

.underline {
  position: absolute;
  bottom: -5rpx; /* 调整线条位置 */
  left: 50%;
  transform: translateX(-50%);
  width: 50%; /* 线条长度，可以根据需要调整 */
  height: 2rpx; /* 线条厚度 */
  background-color: #c3ad40; /* 黄色线条颜色 */
  transition: width 0.3s ease; /* 添加过渡效果 */
}

.tab-content {
  padding: 40rpx;
  border: 2rpx solid #ccc;
  border-radius: 10rpx;
  background-color: #f9f9f9;
  margin-top: 20rpx;
}

.divider {
  text-align: center;
  margin: 40rpx 0;
  font-size: 36rpx;
}
</style>
